import { post, upload, download } from '@/utils/request'

export function fetchList() {
  return post('/exam/api/sys/lesson/teacherList', {})
}

export function fetchStudList(query) {
  return post('/exam/api/sys/lesson/studentList', query)
}

export function deleteData(data) {
  return post('/exam/api/sys/lesson/deleteOne', data)
}

export function saveData(data) {
  return post('/exam/api/sys/lesson/save', data)
}

export function saveUserData(data) {
  return post('/exam/api/sys/userLesson/save', data)
}

/**
 * 导出
 * @param data
 */
export function exportExcel(data) {
  return download('/exam/api/sys/lesson/export', data, '导出的课程数据.xlsx')
}

/**
 * 导入模板
 * @param data
 */
export function importTemplate() {
  return download('/exam/api/sys/lesson/import/template', {}, 'lesson-import-template.xlsx')
}

/**
 * 导入课程
 * @param data
 */
export function importExcel(file) {
  return upload('/exam/api/sys/lesson/import', file)
}

/**
 * 导入模板
 * @param data
 */
export function importStudentsTemplate() {
  return download('/exam/api/sys/userLesson/import/template', {}, 'lessonStudents-import-template.xlsx')
}

/**
 * 导入选课名单
 * @param data
 */
export function importStudentsExcel(file) {
  return upload('/exam/api/sys/userLesson/import', file)
}
